#ifndef TFDEFINETYPE_H
#define TFDEFINETYPE_H

#define DECLARE_TEST_N(TestName, Parent, n) \
	class TestName : public Parent \
		{ \
	public: \
		TestName() : m_Times(0) \
				, Parent(#TestName)\
		{\
			m_pTestVar = new TestName##_##TestVar;\
		}\
		~TestName()\
		{\
			delete m_pTestVar; m_pTestVar = NULL;\
		}\
	protected: \
		\
		struct TestName##_##TestVar* m_pTestVar;\
		bool TestBody()\
		{\
			if (m_Times < n) {\
				Example();\
				return true;\
					}\
			return false;\
		}\
		\
		void NextExample()\
		{\
			m_Times++;\
		}\
		\
		void Example();\
		\
		int m_Times;\
		};\

#define DECLARE_TEST_VAR(TestName) struct TestName##_##TestVar

#define DECLARE_EXAMPLE(TestName)  void TestName::Example()

#define DECLARE_TEST_F(TestName, Parent) DECLARE_TEST_N(TestName, Parent, 1)

#define TEST_VAR(x) m_pTestVar->x

#define CLEAR_TEST_VAR(TestName) delete m_pTestVar; m_pTestVar = NULL; m_pTestVar = new TestName##_##TestVar

#endif
